// RenderWindow.h

#pragma once
#ifndef RENDERWINDOW_H_INCLUDED
#define RENDERWINDOW_H_INCLUDED

#include "Bitmap.h"
#include "Net.h"

class RenderWindow
{
public:

	Bitmap* m_pxBM;

	HINSTANCE m_hInstance;
	WNDCLASS m_xWndClass;
	HWND m_hWnd;
	bool m_bQuit;
	int m_iW,m_iH;
	bool m_bActive;
	GDIFont m_xScoreFont;

	WorldState m_xWorld;
	dword m_dwMyID;
	int m_iLastGameTick;
	int m_iDotCountdown;
	int m_iLastDotID;

	int m_aiUpdateChk[WorldState::MaxPlayers];

	Net m_xNet;

	enum {
		DotCountdownStartValue=50
	};

	enum GameState
	{
		State_Unconnected,
		State_Gather,
		State_MatchStart,
		State_MatchRunning,
		State_MatchFinished
	};

	GameState m_eGameState;

	RenderWindow();
	~RenderWindow();

	bool Init(HINSTANCE p_hInstance);
	void Shut();

	static long RenderWindow::StaticMainWndProc(HWND p_hWnd,int p_iMessage,int p_wWParam,int p_iLParam);

	bool MessagePump(bool p_bFull);
	long MainWndProc(int p_iMessage,int p_wWParam,int p_iLParam);

	virtual void OnResize(int p_iW,int p_iH);
	virtual void Render();

	void OnChar(char p_cKey);

	void CopyCurrentVote();
};

#endif // RENDERWINDOW_H_INCLUDED
